#ifndef _PS400DLL_h_
#define _PS400DLL_h_
#include<minwindef.h>
//================================================================================
// Axis define
#define AXIS_X 										0x1
#define AXIS_Y 										0x2
#define AXIS_Z 										0x4
#define AXIS_U 										0x8


#ifndef PARAMETER_IGNORED
	#define PARAMETER_IGNORED				0xFF
#endif

#ifndef INVALID_AXIS_ASSIGNMENT
	#define INVALID_AXIS_ASSIGNMENT 0x00
#endif

#ifndef PS400_MaxCards
	#define PS400_MaxCards 16  /* for the Hardware ID */
#endif

// definition for External Trigger

#define LOGIC_POSITION						0		// (0<<1)
#define ENCODER_POSITION					2		// (1<<1)

#define DCC_ACTIVE_HIGH						0
#define DCC_ACTIVE_LOW						1


#define MOVE_DIRECTION_FORWARD		1
#define MOVE_DIRECTION_REVERSE		0

// ---------------------------------------------------

#define PITCH_TYPE_MASK						0x01
#define PITCH_SOURCE_MASK					0x02
//---------------------------------------------------------------------------------

#define FEEDBACK_SRC_LOGIC_COMMAND		0x0
#define FEEDBACK_SRC_ENCODER_POSITION	0x1

#define CMPSRC_LOGIC_POSITION			0x00
#define CMPSRC_ENCODE_POSITION			0x01

#define COMP_PLUS_REGISTER				0x00
#define COMP_MINUS_REGISTER				0x01

// Status Codes
#define MOTION_DONE														1
#define MOTION_NOT_DONE													0

#define CONTINUE_INTERPOLATION_NEXT_READY			1
#define CONTINUE_INTERPOLATION_NEXT_NOT_READY		0

#define LOGIC_ACTIVE_LOW					0x0
#define LOGIC_ACTIVE_HIGH					0x1

#define ERC_ON								0x1
#define ERC_OFF								0x0

#define ALMRST_ON							0x1
#define ALMRST_OFF							0x0

#define GDO_ON								0x1
#define GDO_OFF								0x0
#define SERVO_OFF									0x0
#define SERVO_ON									0x1

#define SERVO_AUTO_OFF						0x1
#define SERVO_MANUAL_OFF					0x0

#define DISABLE_FEATURE						0x0
#define ENABLE_FEATURE						0x1

#define MOVE_FORWARD							0x1
#define MOVE_REVERSE 							0x0

#define STOP_SLOWDOWN							0x26
#define STOP_SUDDEN								0x27

#define RATIO2_OPPOSITE_DIRECTION	0x1
#define RATIO2_SAME_DIRECTION			0x0


// Interrupt Event Configuration
#define INT_EVENT_ENABLE_FEATURE	ENABLE_FEATURE 
#define INT_EVENT_DISABLE_FEATURE	DISABLE_FEATURE

// Synchronous Operation 
#define ENABLE_BLOCK_OPEARTION		ENABLE_FEATURE
#define DISABLE_BLOCK_OPEARTION		DISABLE_FEATURE

// Output Pulse Configuration
#define PULSE_MODE_CW_CCW						0x0000
#define PULSE_MODE_PULSE_DIRECTION	0x0040

#define PULSE_LOGIC_ACTIVE_HIGH		0x0000
#define PULSE_LOGIC_ACTIVE_LOW		0x0080

#define PULSE_FORWARD_ACTIVE_LOW	0x0000
#define PULSE_FORWARD_ACTIVE_HIGH	0x0100

//Encoder Configuration
#define ENCODER_MODE_AB						0x0000  // Quadrature pulse input
#define ENCODER_MODE_AB_DIVID_2		0x0400
#define ENCODER_MODE_AB_DIVID_4		0x0800
#define ENCODER_MODE_CW_CCW				0x0200	// Up/Down pulse input

// Hardware Limit Configuration
#define LIMIT_STOP_SUDDEN					0x0000
#define LIMIT_STOP_SLOWDOWN				0x0004

#define LIMIT_LOGIC_ACTIVE_LOW		0x0000
#define LIMIT_LOGIC_ACTIVE_HIGH		0x0018


// Software Limit Configuration
#define SW_LIMIT_ENABLE_FEATURE		0x0003 
#define SW_LIMIT_DISABLE_FEATURE	0x0000

#define SW_LIMIT_CMP_SRC_LOGIC_COMMAND		0x0000
#define SW_LIMIT_CMP_SRC_ENCODER_POSITION	0x0020


// INP Configuration
#define INP_ENABLE_FEATURE					0x8000
#define INP_DISABLE_FEATURE					0x0000

#define INP_LOGIC_ACTIVE_HIGH				0x4000
#define INP_LOGIC_ACTIVE_LOW				0x0000

// ALARM Configuration
#define ALARM_ENABLE_FEATURE				0x2000
#define ALARM_DISABLE_FEATURE				0x0000

#define ALARM_LOGIC_ACTIVE_HIGH			0x1000
#define ALARM_LOGIC_ACTIVE_LOW			0x0000

// Variable Ring Command/Encoder Counter
#define VARIABLE_RING_ENABLE_FEATURE		0x0010
#define VARIABLE_RING_DISABLE_FEATURE		0x0000

// (fixed-pulse Trapezodal motion) Avoid Triangle feature
#define AVOID_TRIANGLE_ENABLE_FEATURE		0x0008
#define AVOID_TRIANGLE_DISABLE_FEATURE	0x0000

// Filter Configuration
#define FILTER_ENABLE_FEATURE						ENABLE_FEATURE 
#define FILTER_DISABLE_FEATURE					DISABLE_FEATURE

#define FILTER_CFG_EMG_EL_ORG_NORG			0x0100
#define FILTER_CFG_ENCODER_Z_PHASE			0x0200
#define FILTER_CFG_INP_ALARM						0x0400
#define FILTER_CFG_EXP_EXPLSN						0x0800
#define FILTER_CFG_IN3									0x1000

#define FILTER_DELAY_2us								0x0000 
#define FILTER_DELAY_256us							0x2000
#define FILTER_DELAY_512us							0x4000
#define FILTER_DELAY_1024us							0x6000
#define FILTER_DELAY_2048us							0x8000
#define FILTER_DELAY_4096us							0xA000
#define FILTER_DELAY_8192us							0xC000
#define FILTER_DELAY_16384us						0xE000

// IN0/NHOME Configuration
#define NHOME_LOGIC_ACTIVE_HIGH					0x0001
#define NHOME_LOGIC_ACTIVE_LOW					0x0000

// IN1/HOME Configuration
#define HOME_LOGIC_ACTIVE_HIGH					0x0004
#define HOME_LOGIC_ACTIVE_LOW						0x0000

// IN2/INDEX Configuration
#define INDEX_LOGIC_ACTIVE_HIGH					0x0010
#define INDEX_LOGIC_ACTIVE_LOW					0x0000

// Auto-Homing Steps Configuration
#define AUTO_HOME_STEP1_DISABLE				0x0000
#define AUTO_HOME_STEP1_FORWARD				0x0001
#define AUTO_HOME_STEP1_REVERSE				0x0003

#define AUTO_HOME_STEP2_DISABLE				0x0000
#define AUTO_HOME_STEP2_FORWARD				0x0004 
#define AUTO_HOME_STEP2_REVERSE				0x000C

#define AUTO_HOME_STEP3_DISABLE				0x0000
#define AUTO_HOME_STEP3_FORWARD				0x0010
#define AUTO_HOME_STEP3_REVERSE				0x0030

#define AUTO_HOME_STEP4_DISABLE				0x0000
#define AUTO_HOME_STEP4_FORWARD				0x0040
#define AUTO_HOME_STEP4_REVERSE				0x00C0


#define STOP_REVERSE_EDGE					0
#define STOP_FORWARD_EDGE					1

#define AUTO_HOME_MODE_0					0x0
#define AUTO_HOME_MODE_1					0x1
#define AUTO_HOME_MODE_2					0x2
#define AUTO_HOME_MODE_3					0x3
#define AUTO_HOME_MODE_4					0x4
#define AUTO_HOME_MODE_5					0x5

// External Signal Configuration
#define EXP_DISABLE_FEATURE						0x0000
#define EXP_AB_PHASE_MPG							0x0018
#define EXP_FIXED_PULSE_START 				0x0010
#define EXP_CW_CCW_ACTIVE_LOW_MPG			EXP_FIXED_PULSE_START
#define EXP_CONTI_MOVE_ACTIVE					0x0008

// Compare & Trigger Configuration
#define CMPTRIG_ENABLE_FEATURE				0x4000
#define CMPTRIG_DISABLE_FEATURE				0x0000

#define CMPTRIG_LOGIC_ACTIVE_HIGH			0x0000
#define CMPTRIG_LOGIC_ACTIVE_LOW			0x1000

#define CMP_SRC_LOGIC_COMMAND					0x0000
#define CMP_SRC_ENCODER_POSITION			0x0020

#define CMPTRIG_CONSTANT_PITCH				VARIABLE_RING_ENABLE_FEATURE				
#define CMPTRIG_VARIABLE_OFFSET				0x0000

#define CMPTRIG_FORWARD_MOVE					MOVE_FORWARD
#define CMPTRIG_REVERSE_MOVE					MOVE_REVERSE

#define TRIG_PULSE_WIDTH_10us					0x0800
#define TRIG_PULSE_WIDTH_20us					0x2800
#define TRIG_PULSE_WIDTH_100us				0x4800
#define TRIG_PULSE_WIDTH_200us				0x6800
#define TRIG_PULSE_WIDTH_1ms					0x8800
#define TRIG_PULSE_WIDTH_2ms					0xA800
#define TRIG_PULSE_WIDTH_10ms					0xC800
#define TRIG_PULSE_WIDTH_20ms					0xE800

// Syncgronous Action Configuration
#define SYNC_ENABLE_FEATURE						ENABLE_FEATURE
#define SYNC_DISABLE_FEATURE					DISABLE_FEATURE

// Synchronization Factor/Provocative
#define SYNC_CONDITION_NONE									0x0000
#define SYNC_CONDITION_EXCEED_CMP_POSITIVE	0x0001
#define SYNC_CONDITION_LESS_CMP_POSITIVE		0x0002
#define SYNC_CONDITION_LESS_CMP_NEGATIVE		0x0004
#define SYNC_CONDITION_EXCEED_CMP_NEGATIVE	0x0008
#define SYNC_CONDITION_START_DRIVING				0x0010
#define SYNC_CONDITION_END_DRIVING					0x0020
#define SYNC_CONDITION_IN3_RAISING_EDGE		  0x0040
#define SYNC_CONDITION_IN3_FALLING_EDGE		  0x0080

// Synchronization Action
#define SYNC_ACTION_NONE										0x0000
#define SYNC_ACTION_FIXED_FORWARD_DRIVE			0x0001
#define SYNC_ACTION_FIXED_REVERSE_DRIVE			0x0002
#define SYNC_ACTION_CONTINUE_FORWARD_DRIVE	0x0004
#define SYNC_ACTION_CONTINUE_REVERSE_DRIVE	0x0008
#define SYNC_ACTION_SLOWDOWN_STOP						0x0010
#define SYNC_ACTION_SUDDEN_STOP							0x0020
#define SYNC_ACTION_LOGIC_CMD_LATCH					0x0040
#define SYNC_ACTION_ENCODER_POS_LATCH				0x0080
#define SYNC_ACTION_DCC_OUT							0x4000

// Interrupt Action
#define INT_ACTION_DRV_START					0x0001
#define INT_ACTION_S_MOVE						0x0002
//---------------------------------------------------------------------------------

// Interporation Arc move
#define INTERP_ARC_DIRECTION_CLOCKWISE			0x0032
#define INTERP_ARC_DIRECTION_COUNTER_CLOCKWISE  0x0033

// Interporation Continue feature
#define INTERP_CONTINUE_START					0x0000
#define INTERP_NEXT_CONTINUOUS_MOTION			0x0001

// Interporation Segment Type
#define CONTI_LINE2_MOVE							0x00
#define CONTI_ARC2_MOVE								0x01
#define CONTI_LINE3_MOVE							0x02
#define CONTI_ABS_LINE2_MOVE						0x10
#define CONTI_ABS_ARC2_MOVE							0x11
#define CONTI_ABS_LINE3_MOVE						0x12



// INT Factors settings
#define INT_FACTOR_DISABLE								0x0000
#define INT_FACTOR_EXCEED_CMP_NEGATIVE		0x0200
#define INT_FACTOR_LESS_CMP_NEGATIVE			0x0400
#define INT_FACTOR_LESS_CMP_POSITIVE			0x0800
#define INT_FACTOR_EXCEED_CMP_POSITIVE		0x1000
#define INT_FACTOR_END_CONST_SPEED_MOVE		0x2000
#define INT_FACTOR_START_CONST_SPEED_MOVE	0x4000
#define INT_FACTOR_END_DRIVING						0x8000

// INT active status
#define INT_STATUS_PLUSE									0x0001
#define INT_STATUS_EXCEED_CMP_NEGATIVE		0x0002
#define INT_STATUS_LESS_CMP_NEGATIVE			0x0004
#define INT_STATUS_LESS_CMP_POSITIVE			0x0008
#define INT_STATUS_EXCEED_CMP_POSITIVE		0x0010
#define INT_STATUS_END_CONST_SPEED_MOVE		0x0020
#define INT_STATUS_START_CONST_SPEED_MOVE	0x0040
#define INT_STATUS_END_DRIVING						0x0080


// Returned Status Definition
// ps400_motion_done();
#define DRIVE_FINISH_WITH_SW_LIMIT_POSITIVE		0x0001
#define DRIVE_FINISH_WITH_SW_LIMIT_NEGATIVE		0x0002
#define DRIVE_FINISH_WITH_STOP_COMMAND				0x0004
#define DRIVE_FINISH_WITH_HOME_EXCEPTION			0x0008
#define DRIVE_FINISH_WITH_HOME_ERROR          0x0040
#define DRIVE_FINISH_OUTPUT_FIXED_PULSE				0x0080
#define DRIVE_FINISH_WITH_AUTO_HOME						0x0100

#define DRIVE_FINISH_WITH_LIMIT_POSITIVE			0x1000
#define DRIVE_FINISH_WITH_LIMIT_NEGATIVE			0x2000
#define DRIVE_FINISH_WITH_ALARM								0x4000
#define DRIVE_FINISH_WITH_EMG									0x8000

// ps400_get_error_status();
#define DRIVE_ERROR_STATUS_SLMTP									0x0001
#define DRIVE_ERROR_STATUS_SLMTM									0x0002
#define DRIVE_ERROR_STATUS_LMTP										0x0004
#define DRIVE_ERROR_STATUS_LMTM										0x0008
#define DRIVE_ERROR_STATUS_ALARM									0x0010
#define DRIVE_ERROR_STATUS_EMG										0x0020
#define DRIVE_ERROR_STATUS_HOME										0x0080

// DI Status Configuration
#define DI_STATUS_ALARM									0x0010
#define DI_STATUS_HOME									0x0020
#define DI_STATUS_NEARHOME							0x0040
#define DI_STATUS_INPUT3								0x0080
#define DI_STATUS_INP										0x0100
#define DI_STATUS_INDEX									0x0200


#define DI_STATUS_ACTIVE_DRIVING				0x0001
#define DI_STATUS_ACTIVE_LMTP						0x0002
#define DI_STATUS_ACTIVE_LMTM						0x0004
#define DI_STATUS_ACTIVE_EMG						0x0008
#define DI_STATUS_ACTIVE_ALARM					DI_STATUS_ALARM
#define DI_STATUS_ACTIVE_HOME						DI_STATUS_HOME
#define DI_STATUS_ACTIVE_NEARHOME				DI_STATUS_NEARHOME
#define DI_STATUS_ACTIVE_INP						DI_STATUS_INP
#define DI_STATUS_ACTIVE_INDEX					DI_STATUS_INDEX


#define FRNET_PERIODIC_READING_ENABLE_FEATURE			ENABLE_FEATURE
#define FRNET_PERIODIC_READING_DISABLE_FEATURE		DISABLE_FEATURE

#define FRNET_ENABLE_DIRECT_ACCESS								ENABLE_FEATURE 
#define FRNET_DISABLE_DIRECT_ACCESS								DISABLE_FEATURE

// FRNET configuration
#define FRNET_RA0							0x0
#define FRNET_RA1							0x1
#define FRNET_RA2							0x2
#define FRNET_RA3							0x3
#define FRNET_RA4							0x4
#define FRNET_RA5							0x5
#define FRNET_RA6							0x6
#define FRNET_RA7							0x7

#define FRNET_SA8							0x8
#define FRNET_SA9							0x9
#define FRNET_SA10						0xA
#define FRNET_SA11						0xB
#define FRNET_SA12						0xC
#define FRNET_SA13						0xD
#define FRNET_SA14						0xE
#define FRNET_SA15						0xF

// the order for rotation delta robot parameters
// ps400_robot_init();
enum ROBOT_PAR_ROTATION_DELTA{
	FIXED_BASE_SIDE_LENGTH,
	END_EFFECTOR_SIDE_LENGTH,
	UPPER_JOINT_LENGTH,
	PARALLELOGRAM_JOINT_LENGTH,
	JOINT_FRAME_OFFSET_ANGLE//offset-angle between the 1st link and the axis X of world frame 
};

// robot type
// ps400_robot_init(); 
#define ROBOT_TYPE_CONFIG_DISABLE 0x0
#define ROBOT_TYPE_SCARA          0x1	// 2 axes
#define ROBOT_TYPE_ROTATION_DELTA 0x2	// 3 axes
#define ROBOT_TYPE_PRISM_DELTA    0x3	// 3 axes
#define ROBOT_TYPE_PYRAMID_DELTA  0x4	// 3 axes
#define ROBOT_TYPE_PALLETIZER     0x5	// 3 axes
#define ROBOT_TYPE_ARTICULATED    0x6	// 3 to 6 axes

#define SUCCESS_NO_ERROR                          0

// indicate the unsuccessful routine-execution
#define ERROR_ROUTINE_FAIL_BASE                   -100
#define ERROR_GET_CARD_ID                         -101
#define ERROR_DEVICE_OPEN                         -102
#define ERROR_DEVICE_CLOSE                        -103
#define ERROR_CARD_RESET                          -104
#define ERROR_RANGE_CHANGE                        -105
#define ERROR_PULSE_MODE_SET                      -106
#define ERROR_ENCODER_MODE_SET                    -107
#define ERROR_LIMIT_SENSOR_SET                    -108
#define ERROR_INP_SIGNAL_SET                      -109
#define ERROR_ALARM_SIGNAL_SET                    -110
#define ERROR_SERVO_ON_SET                        -111
#define ERROR_IN3_SET                             -112
#define ERROR_IN3_GET                             -113
#define ERROR_FILTER_SET                          -114
#define ERROR_SW_LIMIT_SET                        -115
#define ERROR_HOME_CFG_SET                        -116
#define ERROR_HOME_LIMIT_SET                      -117
#define ERROR_START_HOME                          -118
#define ERROR_DI_STATUS_GET                       -119
#define ERROR_ERROR_STATUS_GET                    -120
#define ERROR_CMD_COUNTER_SET                     -121
#define ERROR_CMD_COUNTER_GET                     -122
#define ERROR_POS_COUNTER_SET                     -123
#define ERROR_POS_COUNTER_GET                     -124
#define ERROR_MOTION_DONE_GET                     -125
#define ERROR_SPEED_GET                           -126
#define ERROR_ACCELERATION_GET                    -127
#define ERROR_LATCH_GET                           -128
#define ERROR_MOTION_STOP_SET                     -129
#define ERROR_MOTION_STOP_ALL_SET                 -130
#define ERROR_DRIVE_START                         -131
#define ERROR_DRIVE_HOLD                          -132
#define ERROR_VRING_SET                           -133
#define ERROR_MPG_SET                             -134
#define ERROR_CMPTRIG_SET                         -135
#define ERROR_SYNCH_SET                           -136
#define ERROR_INT_FACTOR_SET                      -137
#define ERROR_INT_STATUS_GET                      -138
#define ERROR_CONTI_MOVE_START                    -139
#define ERROR_CONST_MOVE_START                    -140
#define ERROR_T_MOVE_START                        -141
#define ERROR_S_MOVE_START                        -142
#define ERROR_T_LINE2_START                       -143
#define ERROR_T_LINE3_START                       -144
#define ERROR_S_LINE2_START                       -145
#define ERROR_S_LINE3_START                       -146
#define ERROR_T_ARC2_START                        -147
#define ERROR_CONTI_INTERP_SET                    -148
#define ERROR_CONTI_INTERP_CLEAR                  -149
#define ERROR_CONTI_INTERP_NEXT_READY             -150
#define ERROR_CONTI_INTERP_LINE2_MOVE             -151
#define ERROR_CONTI_INTERP_LINE3_MOVE             -152
#define ERROR_CONTI_INTERP_ARC2_MOVE              -153
#define ERROR_T_DRIVING_SPEED_CHANGE              -154
#define ERROR_T_AVOID_TRIANGLE_SET                -155
#define ERROR_OUTPUT_PULSE_CHANGE                 -156
#define ERROR_OUT1_GET                            -157
#define ERROR_FRNET_DI_MODULE_GET                 -158
#define ERROR_FRNET_FREQUENCY_SET                 -159
#define ERROR_FRNET_INPUT                         -160
#define ERROR_FRNET_OUTPUT                        -161
#define ERROR_FRNET_RESET                         -162

#define ERROR_ALARM_SIGNAL_RESET				  -163
#define ERROR_ERC_SIGNAL_SET					  -164
#define ERROR_GDO_SIGNAL_SET					  -165
#define ERROR_HOME_CFG_EX_SET                     -166
#define ERROR_S_DRIVING_SPEED_CHANGE              -167

// Parameters Error
#define ERROR_INVALID_PARAMETER_BASE              -200
#define ERROR_INVALID_CARD_ID                     -201
#define ERROR_INVALID_SCANNED_INDEX               -202
#define ERROR_CARD_ID_DUPLICATED                  -203
#define ERROR_INVALID_RANGE                       -204
#define ERROR_INVALID_PULSE_MODE                  -205
#define ERROR_INVALID_PULSE_LEVEL                 -206
#define ERROR_INVALID_PULSE_DIRECTION             -207
#define ERROR_INVALID_ENCODER_MODE                -208
#define ERROR_INVALID_LIMIT_LOGIC                 -209
#define ERROR_INVALID_STOP_MODE                   -210
#define ERROR_INVALID_INP_ENABLE                  -211
#define ERROR_INVALID_INP_LOGIC_LEVEL             -212
#define ERROR_INVALID_ALARM_ENABLE                -213
#define ERROR_INVALID_ALARM_LOGIC_LEVEL           -214
#define ERROR_INVALID_SERVO_SETTING               -215
#define ERROR_INVALID_IN3_ENABLE                  -216
#define ERROR_INVALID_IN3_LOGIC_LEVEL             -217
#define ERROR_INVALID_FILTER_ENABLE               -218
#define ERROR_INVALID_FILTER_CONFIGURATION        -219
#define ERROR_INVALID_FILTER_DELAY_TIME           -220
#define ERROR_INVALID_SOFTWARE_LIMIT_ENABLE       -221
#define ERROR_INVALID_SOFTWARE_LIMIT_COMPARATOR_SOURCE	-222
#define ERROR_INVALID_MOVE_DIRECTION              -223
#define ERROR_INVALID_HOME_LOGIC_LEVEL            -224
#define ERROR_INVALID_NEAR_HOME_LOGIC_LEVEL       -225
#define ERROR_INVALID_INDEX_LOGIC_LEVEL           -226
#define ERROR_INVALID_AUTO_HOME_STEP              -227
#define ERROR_INVALID_BLOCK_OPEARTION_MODE         -228
#define ERROR_INVALID_AVOID_TRIANGLE_CONFIG       -229
#define ERROR_INVALID_MPG_EXP_CONFIG              -230
#define ERROR_INVALID_NHOME_SEARCH_SPEED          -231
#define ERROR_INVALID_HOME_SEARCH_SPEED           -232
#define ERROR_INVALID_ACCELERATION                -233
#define ERROR_INVALID_DECELERATION                -234
#define ERROR_INVALID_JERK                        -235
#define ERROR_INVALID_DECELERATION_RATE           -236
#define ERROR_INVALID_RING_COUNTER                -237
#define ERROR_INVALID_RING_ENABLE				  -238
#define ERROR_INVALID_AXIS                        -239
#define ERROR_INVALID_CONST_PITCH                 -240
#define ERROR_INVALID_OFFSET_BUFFER               -241
#define ERROR_INVALID_OFFSET_LEN                  -242
#define ERROR_INVALID_OFFSET_DATA                 -243
#define ERROR_INVALID_START_SPEED                 -244
#define ERROR_INVALID_DRIVING_SPEED               -245
#define ERROR_INVALID_MANUAL_DECELERATION_POINT   -246
#define ERROR_START_SPEED_EXCEED_DRIVING_SPEED    -247
#define ERROR_MULTI_AXES_ASSIGNED                 -248
#define ERROR_NO_VALID_AXIS_ASSIGNED              -249
#define ERROR_INVALID_INTERPOLATION_SLAVE_AXES    -250
#define ERROR_INTERPOLATION_SLAVE_AXES_DUPLICATED -251
#define ERROR_INVALID_SYNCHRONOUS_AXES            -252
#define ERROR_INVALID_INTERPOLATION_ARC_DIRECTION	-253
#define ERROR_INVALID_CONTINUE_INTERPOLATION_MOTION	-254
#define ERROR_INVALID_FRNET_PERIODIC_ENABLE       -255
#define ERROR_INVALID_FRNET_PERIODIC_FACTOR       -256
#define ERROR_INVALID_FRNET_SA_GROUP_ADDRESS      -257
#define ERROR_INVALID_FRNET_RA_GROUP_ADDRESS      -258
#define ERROR_INVALID_FRNET_ACCESS_MODE           -259
#define ERROR_INVALID_COMPARE_SOURCE              -260
#define ERROR_INVALID_MPG_SPEED                   -261
#define ERROR_INVALID_CMPTRIG_ENABLE              -262
#define ERROR_INVALID_CMPTRIG_TRIGGER_MODE        -263
#define ERROR_INVALID_CMPTRIG_LOGIC_LEVEL         -264
#define ERROR_INVALID_CMPTRIG_PULSE_WIDTH         -265
#define ERROR_INVALID_SYNCH_ENABLE                -266
#define ERROR_INVALID_SYNCH_CONDITION             -267
#define ERROR_INVALID_SYNCH_ACTION                -268
#define ERROR_INVALID_EVENT_ENABLE                -269
#define ERORR_INVALID_INT_FACTOR                  -270
#define ERORR_INVALID_FEEDBACK_SOURCE             -271
#define ERROR_INVALID_ALARM_RESET_ENABLE		  -272
#define ERROR_INVALID_ERC_ENABLE				  -273
#define ERROR_INVALID_GDO_ENABLE				  -274
#define ERROR_INVALID_DCC_PULSE_WIDTH			  -275
#define ERROR_INVALID_DCC_LOGIC_LEVEL			  -276
#define ERROR_INVALID_AUTO_HOME_MODE			  -277
#define ERORR_INVALID_CSTM_SET					  -278

// RunTime Error
#define ERROR_RUNTIME_BASE                        -300
#define ERROR_OCCURS_IN_AXIS_X                    -301
#define ERROR_OCCURS_IN_AXIS_Y                    -302
#define ERROR_OCCURS_IN_AXIS_XY                   -303
#define ERROR_OCCURS_IN_AXIS_Z                    -304
#define ERROR_OCCURS_IN_AXIS_XZ                   -305
#define ERROR_OCCURS_IN_AXIS_YZ                   -306
#define ERROR_OCCURS_IN_AXIS_XYZ                  -307
#define ERROR_OCCURS_IN_AXIS_U                    -308
#define ERROR_OCCURS_IN_AXIS_XU                   -309
#define ERROR_OCCURS_IN_AXIS_YU                   -310
#define ERROR_OCCURS_IN_AXIS_XYU                  -311
#define ERROR_OCCURS_IN_AXIS_ZU                   -312
#define ERROR_OCCURS_IN_AXIS_XZU                  -313
#define ERROR_OCCURS_IN_AXIS_YZU                  -314
#define ERROR_OCCURS_IN_AXIS_XYZU                 -315

#define	ERROR_NO_CARD_FOUND                       -316
#define ERROR_MEMORY_MAP                          -317
#define ERROR_MEMORY_UNMAP                        -318
#define ERROR_ACCESS_VIOLATION_DATA_COPY          -319
#define ERROR_VARIABLE_PITCH_SET                  -320
#define	ERROR_INT_EVENT_ATTACH                    -321
#define ERROR_INT_EVENT_DETTACH                   -322
#define ERROR_INT_EVENT_CREATE                    -323
#define ERROR_CONFIG_IS_NEEDED                    -324
#define ERROR_MOTION_NOT_COMPLETE                 -325
#define ERROR_CONFLICT_WITH_SOFTLIMIT             -326
#define ERROR_CONFLICT_WITH_CMPTRIG               -327
#define ERROR_CONFLICT_WITH_VRING                 -328
#define ERROR_CONFLICT_WITH_SYNCH_ACTION          -329
#define ERROR_ARC_DECELERATION_POINT_CALCULATE    -330
#define ERROR_REASSIGN_SYNCH_MODE_COMMAND         -331
#define ERROR_OVERLAP_EVENT_CREATE                -332
#define ERROR_INTERPOLATION_NOT_COMPLETE          -333
#define ERROR_CONTI_INTERP_INTERRUPTED            -334
#define ERROR_CONTI_INTERP_INCORRECT_CONFIG       -335
#define ERROR_CONTI_INTERP_NEXT_NOT_READY         -336
#define ERROR_SPEED_CHANGE_FAIL_IN_ACC_DEC        -337
#define ERROR_INVALID_OPERATION_IN_S_CURVE        -338
#define ERROR_NOT_CONSTANT_SPEED_IN_T_MOVE        -339
#define ERROR_MOTION_IS_COMPLETED                 -340
#define ERROR_CONFLICT_WITH_INTERPOLATION_MOVE    -341
#define ERROR_HOLD_AXES_NOT_MATCH                 -342
#define ERROR_BLOCK_OP_CONFLICT_WITH_CMPTRIG      -343
#define ERROR_CONFLICT_WITH_MPG                   -344
#define ERROR_HOLD_AXES_NOT_RELEASE               -345
#define ERROR_ZPHASE_ACTIVE_AT_STEP3              -346
#define ERROR_BLOCK_OP_CONFLICT_WITH_DRV_HOLD     -347

#define ERROR_AXES_MOVE_CHECK                     -360
#define ERROR_IOCTL_FAILED                        -361
#define ERROR_UNDEFINED_EXCEPTION                 -362

#define ERROR_CONFIG_FILE_LOAD                    -370
#define ERROR_CONFLICT_IN_CONFIG_FILE             -371
#define ERROR_INVALID_FILE_HANDLE                 -372

#define ERROR_CONTI_INTERP_SEGMENT_QUANTITY_OVER  -391
#define ERROR_CONTI_INTERP_COMBINE_2AXES_3AXES	  -392
#define ERROR_CONTI_INTERP_COMBINE_REL_ABS	      -393

#define ERROR_U_SHAPED_MOVE_CMP_ADDR_OUT_RANGE	  -394

#define ERROR_ROBOT_INTI_REASSIGN                 -395
#define ERROR_ROBOT_INVALID_CONFIG                -396
#define ERROR_ROBOT_INV_KINE_FAIL                 -397
#define ERROR_ROBOT_FWD_KINE_FAIL                 -398
#define ERROR_ROBOT_NOT_SUPPORTED_YET             -399
#define ERROR_ROBOT_INVALID_ID                    -400

//ps4x0_set_customization
#define CUST_CLR_AFTER_HOME					0x1 
#define CUST_REPLACE_SPEED_PAR 				0x2
#define CUST_SET_ACC_BY_TIME				0x3
#define CUST_CNST_VECTOR_SPEED				0x4
#define CUST_VCHANGE_IN_S_CURVE				0x5
#define CUST_CHECK_INTERP_SLAVE_SPEED     	0x6
#define CUST_STOP_SUDDEN_BLOCK_DISABLE		0x7

//ps4x0_conti_interp_start
//Segment_Type
#define LINE2_MOVE							0x0
#define ARC2_MOVE							0x1
#define LINE3_MOVE							0x2

#ifndef _DEF_NOVA_AXIS_RANGE_SETTINGS
#define _DEF_NOVA_AXIS_RANGE_SETTINGS


typedef struct _AXIS_RANGE_SETTINGS_
{
	DWORD AcceRate_Max; // for Jerk & Deceleration
	DWORD AcceRate_Min;
	DWORD Acce_Min; // for Acceleration & Deceleration
	DWORD Acce_Max;
	DWORD Speed_Min; // for Initial Speed & Driving Speed
	DWORD Speed_Max;
} AXIS_RANGE_SETTINGS, *PAXIS_RANGE_SETTINGS;

typedef struct _CONTI_INTERP_SEGMENTS_
{
	BYTE  Segment_Type; //0=>2_line, 1=>2_arc, 2=>3_line
	DWORD MainAxisFinishPoint;	/* Finish point of MainAxis */
	DWORD SecondAxisFinishPoint;/* Finish point of SecondAxis */
	DWORD ThirdAxisFinishPoint; /* Finish point of ThirdAxis */
	BYTE ArcDirection;			/* Arc Direction */
	DWORD MainAxisCenterPoint;	/* Center point of MainAxis */
	DWORD SecondAxisCenterPoint;/* Center point of SecondAxis */
} CONTI_INTERP_SEGMENTS;

#endif // _DEF_NOVA_AXIS_RANGE_SETTINGS

#define ps400_set_position 		ps400_set_enccounter
#define ps400_get_position 		ps400_get_enccounter
#ifdef __cplusplus
extern "C"
{
#endif

//============================================================================
//====================== PS4x0 DLL Release Functions for Robot================
//============================================================================
short __stdcall ps400_robot_init
    (
    BYTE bCardID,         /* the specific Card ID that is configured by onboard DIP-switch */
    BYTE bRobotType,      /* ROBOT_TYPE_CONFIG_DISABLE .... ROBOT_TYPE_ARTICULATED*/	
    float fParameters[],  /* Robot initial parameters */
    int* pRobotID         /* return the initialized Robot ID, -1 means initialization failed */
    );

short __stdcall ps400_robot_fwd_kine
    (
    BYTE bCardID,           /* the specific Card ID that is configured by onboard DIP-switch */
    int nRobotID,           /* the specific Robot ID that is assigned by ps400_robot_init() */
    float fMotorPos[],      /* the position of motor */
    float fEndEffectorPos[] /* the position of end effector */
    );

short __stdcall ps400_robot_inv_kine
    (
    BYTE bCardID,           /* the specific Card ID that is configured by onboard DIP-switch */	
    int nRobotID,           /* the specific Robot ID that is assigned by ps400_robot_init() */
    float fEndEffectorPos[],/* the position of end effector */
    float fMotorPos[]       /* the position of motor */
    );
	
//============================================================================
//====================== PS400 DLL (V3.0) Release Functions===================
//============================================================================
// OS Configuration Routines
short __stdcall ps400_scan
    (
    short* pCardNum,         /* pointer to available PISO-PS400 cards */
		BYTE* pAvailCards = NULL /* pointer to available cards array */
    );

short __stdcall ps400_get_cardinfo
    (
    int ScannedIndex,        /* PISO-VS600 scanned index, start with 0 */
		BYTE* pCardID				 /* pointer to Card ID */
    );

short __stdcall ps400_open
    (
    BYTE bCardID         /* the specific Card ID that is configured by onboard DIP-switch */
    );

short __stdcall ps400_close
    (
    BYTE bCardID         /* the specific Card ID that is configured by onboard DIP-switch */
    );

short __stdcall ps400_open_all (void);

short __stdcall ps400_close_all (void);

short __stdcall ps400_reset_all (void);

short __stdcall ps400_reset
    (
    BYTE bCardID         /* the specific Card ID that is configured by onboard DIP-switch */
    );

short __stdcall ps400_set_range
    (
    BYTE bCardID,         /* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,           /* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    DWORD dwRange         /* the valid dwRange value is 16000 ~ 8000000  */
    );

short __stdcall ps400_set_max_v
    (
    BYTE bCardID,         /* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,           /* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    DWORD dwMaxSpeed      /* the valid dwMaxSpeed value is 8000 ~ 4000000  */
    );

short __stdcall ps400_get_range_settings
    (
    BYTE bCardID,         /* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,           /* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    AXIS_RANGE_SETTINGS* pAxisRangeSetting  /* the point to PS400_AXIS_CONFIG structure  */
    );

// Hardware Configuration Routines (Required)
short __stdcall ps400_set_pls_cfg
    (
    BYTE bCardID,         /* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,           /* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    WORD wPulseMode,      /* pulse mode: the settings will be PULSE_MODE_CW_CCW or PULSE_MODE_PULSE_DIRECTION  */
    WORD wPulseLogic,     /* pulse polarity: the settings will be PULSE_LOGIC_ACTIVE_HIGH or PULSE_LOGIC_ACTIVE_LOW */
    WORD wDirectionLogic  /* direction polarity: the settings will be PULSE_FORWARD_ACTIVE_HIGH or PULSE_FORWARD_ACTIVE_LOW. This setting is valid for PULSE_MODE_PULSE_DIRECTION mode */
    );

short __stdcall ps400_set_enc_cfg
    (
    BYTE bCardID,         /* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,           /* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    WORD wEncoderMode,    /* encoder mode: the settings will be ENCODER_MODE_AB, ENCODER_MODE_AB_DIVID_2, ENCODER_MODE_AB_DIVID_4 or ENCODER_MODE_CW_CCW  */
    BYTE bCounterSource = 0  /* this setting is reserved and ignored */
    );

short __stdcall ps400_set_limit
    (
    BYTE bCardID,         /* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,           /* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    WORD wLimitLogic,     /* EL(Limit Sensor) polarity: the settings will be LIMIT_LOGIC_ACTIVE_HIGH or LIMIT_LOGIC_ACTIVE_LOW */
    WORD wStopMode = LIMIT_STOP_SUDDEN /* stop mode: the setting will be LIMIT_STOP_SUDDEN or LIMIT_STOP_SLOWDOWN */
    );

// Hardware Configuration Routines (Optional)
short __stdcall ps400_set_inp
    (
    BYTE bCardID,         /* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,           /* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    WORD wINPEnable,      /* INP_ENABLE_FEATURE/INP_DISABLE_FEATURE to enable/disable in-position signal */
    WORD wINPLogic		  /* in-position signal polarity: the setting will be INP_LOGIC_ACTIVE_HIGH or INP_LOGIC_ACTIVE_LOW */
    );

short __stdcall ps400_set_alarm
    (
    BYTE bCardID,         /* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,           /* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    WORD wAlarmEnable,    /* ALARM_ENABLE_FEATURE/ALARM_DISABLE_FEATURE to enable/disable in-position signal */
    WORD wAlarmLogic	  /* in-position signal polarity: the setting will be ALARM_LOGIC_ACTIVE_HIGH or ALARM_LOGIC_ACTIVE_LOW */
    );

short __stdcall ps400_servo_on
    (
    BYTE bCardID,         /* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,           /* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    BYTE bServoON,		  	/* SERVO_ON/SERVO_OFF to switch on/off servo*/
		BYTE bAutoOFF		  		/* SERVO_AUTO_OFF/SERVO_MANUAL_OFF. ps400_close()/ps400_close_all() Turn off Servo */
    );

short __stdcall ps400_load_config
    (
		char* FileName = NULL      /* pointer to pathname of configuration file */
    );

short __stdcall ps400_set_filter
    (
    BYTE bCardID,         /* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,           /* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    WORD wFilterEnable,	  /* FILTER_ENABLE_FEATURE/FILTER_DISABLE_FEATURE to enable/disable filter feature */
    WORD wFilterCfg,	  /* combanation of FILTER_CFG_EMG_EL_ORG_NORG, ... FILTER_CFG_IN3  */
    WORD wDelayTime	      /* FILTER_DELAY_2us, FILTER_DELAY_256us, ... FILTER_DELAY_8192us*/
    );

short __stdcall ps400_set_softlimit
    (
    BYTE bCardID,         /* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,           /* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    WORD wSWLimitEnable,	  /* SW_LIMIT_ENABLE_FEATURE/SW_LIMIT_DISABLE_FEATURE to enable/disable filter feature */
    WORD wCmpSource,	  /* CMP_SRC_LOGIC_COMMAND/CMP_SRC_ENCODER_POSITION */
    long LimitPositive,	  /* -2147483647 ~ 2147483647 */
    long LimitNegaitive   /* -2147483647 ~ 2147483647 */
    );

// Home Operation
short __stdcall ps400_set_home_cfg
    (
    BYTE bCardID,         /* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,           /* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    WORD wHomeLogic,	  /* HOME_LOGIC_ACTIVE_HIGH/HOME_LOGIC_ACTIVE_LOW  */
    WORD wNHomeLogic,	  /* NHOME_LOGIC_ACTIVE_HIGH/NHOME_LOGIC_ACTIVE_LOW */
    WORD wIndexLogic,	  /* INDEX_LOGIC_ACTIVE_HIGH/INDEX_LOGIC_ACTIVE_LOW */
    WORD wHomeSteps,	  /* AUTO_HOME_STEP1_DISABLE, ... AUTO_HOME_STEP4_REVERSE */
		DWORD dwStep4Offset   /* the offset driving in Step4 */
    );

short __stdcall ps400_home_start
    (
    BYTE bCardID,				/* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,					/* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
		DWORD dwStartSpeed,			/* Start Speed */
		DWORD dwAcceleration,		/* Acceleration */
		DWORD dwDeceleration,		/* Deceleration */
    DWORD dwNHomeSearchSpeed,	/* Driving Speed when Near-Home searching */
    DWORD dwHomeSearchSpeed,	/* Driving Speed after Near-Home sensor is active */
		WORD  wBlockMode = DISABLE_BLOCK_OPEARTION /* ENABLE_BLOCK_OPEARTION, DISABLE_BLOCK_OPEARTION */
    );

// External Home Operation
short __stdcall ps400_set_home_cfg_ex
    (
    BYTE bCardID,         /* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,           /* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    WORD wHomeLogic,	  /* HOME_LOGIC_ACTIVE_HIGH/HOME_LOGIC_ACTIVE_LOW  */
    WORD wNHomeLogic,	  /* NHOME_LOGIC_ACTIVE_HIGH/NHOME_LOGIC_ACTIVE_LOW */
    WORD wIndexLogic,	  /* INDEX_LOGIC_ACTIVE_HIGH/INDEX_LOGIC_ACTIVE_LOW */
    WORD wHomeMode,		  /* */
	BYTE bDirection 	  /* MOVE_DIRECTION_FORWARD/MOVE_DIRECTION_REVERSE */
    );

short __stdcall ps400_home_start_ex
    (
    BYTE bCardID,				/* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,					/* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
	DWORD dwStartSpeed,			/* Start Speed */
	DWORD dwAcceleration,		/* Acceleration */
	DWORD dwDeceleration,		/* Deceleration */
    DWORD dwNHomeSearchSpeed,	/* Driving Speed when Near-Home searching */
    DWORD dwHomeSearchSpeed,	/* Driving Speed after Near-Home sensor is active */
	WORD wSyncMode				/* ENABLE_BLOCK_OPEARTION, DISABLE_BLOCK_OPEARTION */
    );
	
short __stdcall ps400_velocity_move
    (
    BYTE bCardID,			/* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,				/* can be combination of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
		DWORD dwStartSpeed,		/* Start Speed */
		DWORD dwDriveSpeed,		/* Driving Speed */
		DWORD dwAcceleration,	/* Acceleration */
    BYTE  bDirection		/* MOVE_DIRECTION_FORWARD/MOVE_DIRECTION_REVERSE */
    );

short __stdcall ps400_const_move
    (
    BYTE bCardID,			/* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,				/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    DWORD dwDriveSpeed,		/* Driving Speed */
    long  FixedPulse		/* total driving pulse */
    );

short __stdcall ps400_const_moveall
    (
    BYTE bCardID,			/* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxes,				/* can be any combination of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    DWORD dwDriveSpeed[],	/* Driving Speed */
    long  FixedPulse[]		/* total driving pulse */
    );

short __stdcall ps400_t_set_avtri
    (
    BYTE bCardID,			/* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,				/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    WORD wAvTriCfg			/* AVOID_TRIANGLE_ENABLE_FEATURE/AVOID_TRIANGLE_DISABLE_FEATURE */
    );

short __stdcall ps400_s_set_avtri
    (
    BYTE bCardID,			/* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,				/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    WORD wAvTriCfg			/* AVOID_TRIANGLE_ENABLE_FEATURE/AVOID_TRIANGLE_DISABLE_FEATURE */
    );

short __stdcall ps400_t_change_v
    (
    BYTE bCardID,			/* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,				/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    DWORD dwDriveSpeed,		/* Driving Speed */
    DWORD dwAcceleration = 0,	/* Acceleration */
    DWORD dwDeceleration = 0	/* Deceleration */
	);

short __stdcall ps400_s_change_v
    (
    BYTE bCardID,			/* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,				/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    DWORD dwDriveSpeed,		/* Driving Speed */
    DWORD dwAccelerationRate = 0,	/* Acceleration Increasing Rate */
    DWORD dwDecelerationRate = 0	/* Deceleration Increasing Rate */
	);

short __stdcall ps400_t_move
    (
    BYTE bCardID,			/* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,				/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
		DWORD dwStartSpeed,		/* Start Speed */
		DWORD dwDriveSpeed,		/* Driving Speed */
		DWORD dwAcceleration,	/* Acceleration */
		DWORD dwDeceleration,	/* Deceleration */
		long FixedPulse,		/* total driving pulse */
		short wAccCntOffset	= 0	/* Acceleration Counter Offset */
		);

short __stdcall ps400_t_moveall
    (
    BYTE bCardID,			/* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxes,				/* can be any combination of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
		DWORD dwStartSpeed[],		/* Start Speed */
		DWORD dwDriveSpeed[],		/* Driving Speed */
		DWORD dwAcceleration[],	/* Acceleration */
		DWORD dwDeceleration[],	/* Deceleration */
		long FixedPulse[],			/* total driving pulse */
		short wAccCntOffset[]	= NULL	/* Acceleration Counter Offset */
    );

short __stdcall ps400_s_move
    (
    BYTE bCardID,			/* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,				/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
		DWORD dwStartSpeed,		/* Start Speed */
		DWORD dwDriveSpeed,		/* Driving Speed */
		DWORD dwAccelerationRate,	/* Acceleration Increasing Rate, Jerk (K) */
		DWORD dwDecelerationRate,	/* Deceleration Increasing Rate(L) */
		long FixedPulse,		/* total driving pulse */
		short wAccCntOffset	= 0	/* Acceleration Counter Offset */
		);

short __stdcall ps400_s_moveall
    (
    BYTE bCardID,			/* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxes,				/* can be any combination of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
		DWORD dwStartSpeed[],		/* Start Speed */
		DWORD dwDriveSpeed[],		/* Driving Speed */
		DWORD dwAccelerationRate[],	/* Acceleration Increasing Rate */
		DWORD dwDecelerationRate[],	/* Deceleration Increasing Rate */
		long FixedPulse[],			/* total driving pulse */
		short wAccCntOffset[]	= NULL	/* Acceleration Counter Offset */
    );
//add by nat
short __stdcall ps400_set_customization
    (
    BYTE bCardID,         /* the specific Card ID that is configured by onboard DIP-switch */
    WORD wCstmParam,    /* Customization Parameters*/
    WORD wValue		  /* TRUE or FALSE*/
    );

short __stdcall ps400_t_line2_move
    (
    BYTE bCardID,				/* the specific Card ID that is configured by onboard DIP-switch */
    WORD wMainAxis,				/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    WORD wSlaveAxis,			/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
		DWORD dwStartSpeed,			/* Start Speed */
		DWORD dwDriveSpeed,			/* Driving Speed */
		DWORD dwAcceleration,		/* Acceleration */
		DWORD dwDeceleration,		/* Deceleration */
		long MainAxisFinishPoint,	/* Finish point of MainAxis */
		long SlaveAxisFinishPoint,	/* Finish point of SlaveAxis */
		short wAccCntOffset = 0,		/* Acceleration Counter Offset, only valid for IntepStop = TRUE */
		WORD wBlockMode = DISABLE_BLOCK_OPEARTION				/* indicate the Synch/Async mode is applied. */
		);

short __stdcall ps400_t_line3_move
    (
    BYTE bCardID,				/* the specific Card ID that is configured by onboard DIP-switch */
    WORD wMainAxis,				/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    WORD wSecondAxis,			/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    WORD wThirdAxis,			/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
		DWORD dwStartSpeed,			/* Start Speed */
		DWORD dwDriveSpeed,			/* Driving Speed */
		DWORD dwAcceleration,		/* Acceleration */
		DWORD dwDeceleration,		/* Deceleration */
		long MainAxisFinishPoint,	/* Finish point of MainAxis */
		long SecondAxisFinishPoint,	/* Finish point of 2nd Axis */
		long ThirdAxisFinishPoint,	/* Finish point of 3rd Axis */
		short wAccCntOffset = 0,		/* Acceleration Counter Offset, only valid for IntepStop = TRUE */
		BYTE bSyncMode = DISABLE_BLOCK_OPEARTION				/* indicate the Synch/Async mode is applied. */
		);

short __stdcall ps400_s_line2_move
    (
    BYTE bCardID,				/* the specific Card ID that is configured by onboard DIP-switch */
    WORD wMainAxis,				/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    WORD wSlaveAxis,			/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
		DWORD dwStartSpeed,			/* Start Speed */
		DWORD dwDriveSpeed,			/* Driving Speed */
		DWORD dwAccelerationRate,	/* Acceleration */
		DWORD dwDecelerationRate,	/* Deceleration */
		long MainAxisFinishPoint,	/* Finish point of MainAxis */
		long SlaveAxisFinishPoint,	/* Finish point of SlaveAxis */
		short wAccCntOffset = 0,		/* Acceleration Counter Offset, only valid for IntepStop = TRUE */
		WORD wBlockMode = DISABLE_BLOCK_OPEARTION				/* indicate the Synch/Async mode is applied. */
		);

short __stdcall ps400_s_line3_move
    (
    BYTE bCardID,				/* the specific Card ID that is configured by onboard DIP-switch */
    WORD wMainAxis,				/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    WORD wSecondAxis,			/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    WORD wThirdAxis,			/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
		DWORD dwStartSpeed,			/* Start Speed */
		DWORD dwDriveSpeed,			/* Driving Speed */
		DWORD dwAccelerationRate,	/* Acceleration */
		DWORD dwDecelerationRate,	/* Deceleration */
		long MainAxisFinishPoint,	/* Finish point of MainAxis */
		long SecondAxisFinishPoint,	/* Finish point of 2nd Axis */
		long ThirdAxisFinishPoint,	/* Finish point of 3rd Axis */
		short wAccCntOffset = 0,		/* Acceleration Counter Offset, only valid for IntepStop = TRUE */
		BYTE bSyncMode = DISABLE_BLOCK_OPEARTION	/* indicate the Synch/Async mode is applied. */
		);

short __stdcall ps400_t_arc2_move
    (
    BYTE bCardID,				/* the specific Card ID that is configured by onboard DIP-switch */
    WORD wMainAxis,				/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    WORD wSlaveAxis,			/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
		DWORD dwStartSpeed,			/* Start Speed */
		DWORD dwDriveSpeed,			/* Driving Speed */
		DWORD dwAcceleration,		/* Acceleration */
		WORD wArcDirection,			/* INTERP_ARC_DIRECTION_CLOCKWISE/INTERP_ARC_DIRECTION_COUNTER_CLOCKWISE */
		long MainAxisCenterPoint,	/* Center point of MainAxis */
		long SlaveAxisCenterPoint,	/* Center point of SlaveAxis */
		long MainAxisFinishPoint,	/* Finish point of MainAxis */
		long SlaveAxisFinishPoint,	/* Finish point of SlaveAxis */
		short wAccCntOffset = 0,	/* Acceleration Counter Offset */
		BYTE bSyncMode = DISABLE_BLOCK_OPEARTION	/* indicate the Synch/Async mode is applied. */
		);

short __stdcall ps400_conti_interp_start
    (
    BYTE bCardID,				/* the specific Card ID that is configured by onboard DIP-switch */
    WORD wMainAxis,				/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    WORD wSecondAxis,			/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    WORD wThirdAxis,			/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
	DWORD dwConstSpeed,			/* Constant Speed */
	CONTI_INTERP_SEGMENTS SEGMENTS[],
	BYTE bSegmentsAmount
    );

short __stdcall ps400_conti_interp_running_segment
    (
    BYTE bCardID,				/* the specific Card ID that is configured by onboard DIP-switch */
	BYTE *bRunningSegNum		/* the number of the current running segment */
    ); 

short __stdcall ps400_conti_interp_begin
    (
    BYTE bCardID,				/* the specific Card ID that is configured by onboard DIP-switch */
    WORD wMainAxis,				/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    WORD wSecondAxis,			/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    WORD wThirdAxis,			/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
		DWORD dwConstSpeed			/* Constant Speed */
    );


short __stdcall ps400_conti_interp_next_ready
    (
    BYTE bCardID,				/* the specific Card ID that is configured by onboard DIP-switch */
		BYTE *pReady				/* the pointer to indicate the Next-Interpolation is ready to set */ 
    );


short __stdcall ps400_conti_line2_move
    (
    BYTE bCardID,				/* the specific Card ID that is configured by onboard DIP-switch */
		long MainAxisFinishPoint,	/* Finish point of MainAxis */
		long SlaveAxisFinishPoint,	/* Finish point of SlaveAxis */
		WORD wContiInterpMoveMode	/* INTERP_CONTINUE_START/INTERP_NEXT_CONTINUOUS_MOTION */		
		);

short __stdcall ps400_conti_line3_move
    (
    BYTE bCardID,				/* the specific Card ID that is configured by onboard DIP-switch */
		long MainAxisFinishPoint,	/* Finish point of MainAxis */
		long SecondAxisFinishPoint,	/* Finish point of 2nd Axis */
		long ThirdAxisFinishPoint,	/* Finish point of 3rd Axis */
		WORD wContiInterpMoveMode	/* INTERP_CONTINUE_START/INTERP_NEXT_CONTINUOUS_MOTION */		
		);

short __stdcall ps400_conti_arc2_move
    (
    BYTE bCardID,				/* the specific Card ID that is configured by onboard DIP-switch */
		WORD wArcDirection,			/* INTERP_ARC_DIRECTION_CLOCKWISE/INTERP_ARC_DIRECTION_COUNTER_CLOCKWISE */
		long MainAxisCenterPoint,	/* Center point of MainAxis */
		long SlaveAxisCenterPoint,	/* Center point of SlaveAxis */
		long MainAxisFinishPoint,	/* Finish point of MainAxis */
		long SlaveAxisFinishPoint,	/* Finish point of SlaveAxis */
		WORD wContiInterpMoveMode	/* INTERP_CONTINUE_START/INTERP_NEXT_CONTINUOUS_MOTION */		
		);

short __stdcall ps400_conti_interp_end
    (
    BYTE bCardID				/* the specific Card ID that is configured by onboard DIP-switch */
    ); 

short __stdcall ps400_conti_interp_config
	(
    BYTE bCardID,				/* the specific Card ID that is configured by onboard DIP-switch */
	WORD wMainAxis,				/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
	WORD wSecondAxis,			/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
	WORD wThirdAxis,			/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
	DWORD dwStartSpeed,			/* Start Speed */
	DWORD dwDriveSpeed,			/* Driving Speed */
	DWORD dwAcceleration,		/* Acceleration */
	DWORD dwDeceleration,		/* Deceleration */
	BYTE bDecPointTuning		/* 0~100 */
	);

short __stdcall ps400_conti_abs_line3_move_load
    (
    BYTE bCardID,			/* the specific Card ID that is configured by onboard DIP-switch */
    long MainAxisAbsAddr,	/* Absolute-Address of MainAxis */
    long SecondAxisAbsAddr,	/* Absolute-Address of 2nd Axis */    
    long ThirdAxisAbsAddr	/* Absolute-Address of 3rd Axis */      
	);

short __stdcall ps400_conti_interp_start_all
	(
    BYTE bCardID				/* the specific Card ID that is configured by onboard DIP-switch */
	);
	
short __stdcall ps400_set_cmdcounter
    (
    BYTE bCardID,         /* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,           /* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    long lData			  /* the position count to be set into Logic Posistion Counter*/
    );


short __stdcall ps400_set_enccounter
    (
    BYTE bCardID,         /* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,           /* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    long lData			  /* the position count to be set into Logic Posistion Counter*/
    );

short __stdcall ps400_get_cmdcounter
    (
    BYTE bCardID,         /* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,           /* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    long* pData			  /* the pointer to the Logic Posistion Counter*/
    );

short __stdcall ps400_get_enccounter
    (
    BYTE bCardID,         /* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,           /* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    long* pData			  /* the pointer to the Logic Posistion Counter*/
    );

short __stdcall ps400_stop_move
    (
    BYTE bCardID,         /* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,           /* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
		WORD wStopMode		  /* can be STOP_SLOWDOWN or STOP_SUDDEN */
    );

short __stdcall ps400_stop_move_all
    (
    BYTE bCardID,         /* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxes,           /* can be any combination of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
		WORD wStopMode		  /* can be STOP_SLOWDOWN or STOP_SUDDEN */
    );
    
short __stdcall ps400_drv_start
    (
    BYTE bCardID,         /* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxes            /* can be any commbination of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    );

short __stdcall ps400_drv_hold
    (
    BYTE bCardID,         /* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxes            /* can be any commbination of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    );

short __stdcall ps400_set_vring
    (
    BYTE   bCardID,         /* the specific Card ID that is configured by onboard DIP-switch */
    WORD   wAxis,           /* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    WORD   wVRINGEnable,    /* VARIABLE_RING_ENABLE_FEATURE/VARIABLE_RING_DISABLE_FEATURE*/
		DWORD  dwRingValue		/* the maximum value of Ring-Counter (start from 0 and 0xFFFFFFFF is the max. value) */ 
    );

short __stdcall ps400_set_mpg
    (
    BYTE   bCardID,         /* the specific Card ID that is configured by onboard DIP-switch */
    WORD   wAxis,           /* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    WORD   wEXPConfig,      /* EXP_DISABLE_FEATURE/EXP_AB_PHASE_MPG/EXP_CW_CCW_ACTIVE_LOW_MPG/EXP_CONTI_MOVE_ACTIVE */
    DWORD  dwFixedPulse,    /* the output pulse for MPG trigger for EXP_AB_PHASE_MPG/EXP_CW_CCW_FIXED_PULSE modes*/
	DWORD  dwSpeed,			/* the constant speed for pulse output */ 
	DWORD  dwMaxMPGFreq 	/* the maximum frequency of Manual-Pulse-Generator */ 
    );

short __stdcall ps400_cmptrig_config
    (
    BYTE   bCardID,         /* the specific Card ID that is configured by onboard DIP-switch */
    WORD   wAxis,           /* can be one of AXIS_X or AXIS_Y*/
    WORD   wCmpTrigEnable,  /* CMPTRIG_ENABLE_FEATURE/CMPTRIG_DISABLE_FEATURE */
    WORD   wCmpSource,		/* CMP_SRC_LOGIC_COMMAND/CMP_SRC_ENCODER_POSITION */
    WORD   wCmpTrigMode,	/* CMPTRIG_CONSTANT_PITCH/CMPTRIG_VARIABLE_OFFSET */
    WORD   wOutputLogic,	/* CMPTRIG_LOGIC_ACTIVE_HIGH/CMPTRIG_LOGIC_ACTIVE_LOW */
    WORD   wPulseWidth,		/* TRIG_PULSE_WIDTH_100us ~ TRIG_PULSE_WIDTH_20ms */
		WORD   wMoveDirection,	/* CMPTRIG_FORWARD_MOVE/CMPTRIG_REVERSE_MOVE, only for CMPTRIG_VARIABLE_OFFSET mode*/
    DWORD  dwConstPitch,    /* pitch for CMPTRIG_CONSTANT_PITCH mode*/
		long*  pVarOffset,		/* the array contains the variable compare & trigger offset */ 
		DWORD  dwOffLen			/* the data-number in pVarOffset (by long) */ 
    );

short __stdcall ps400_set_synch
    (
    BYTE   bCardID,					/* the specific Card ID that is configured by onboard DIP-switch */
    WORD   wMainAxis,				/* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U */
		WORD   wSyncEnable,				/* SYNC_ENABLE_FEATURE/SYNC_DISABLE_FEATURE*/
    WORD   wSyncAxes,				/* can be combination of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U */
    WORD   wSyncCondition,			/* SYNC_CONDITION_EXCEED_CMP_POSITIVE ... SYNC_CONDITION_IN3_FALLING_EDGE */
    WORD   wSyncActionMainAxis,		/* the Sync. Action of own-Axis, SYNC_ACTION_FIXED_FORWARD_DRIVE ... SYNC_ACTION_WR6_TO_VELOCITY_REG */
    WORD   wSyncActionOtherAxes,	/* the Sync. Action of other-Axes, SYNC_ACTION_FIXED_FORWARD_DRIVE ... SYNC_ACTION_WR6_TO_VELOCITY_REG */
    WORD   wCmpSource,				/* CMP_SRC_LOGIC_COMMAND/CMP_SRC_ENCODER_POSITION */
		DWORD  dwComparatorPositive,	/* the value to be set to COMP+, only for SYNC_CONDITION_EXCEED_CMP_POSITIVE and SYNC_CONDITION_LESS_CMP_POSITIVE */
		DWORD  dwComparatorNegative		/* the value to be set to COMP-, only for SYNC_CONDITION_LESS_CMP_NEGATIVE and SYNC_CONDITION_EXCEED_CMP_NEGATIVE */
    );

short __stdcall ps400_synch_t_move_cfg
		(
    BYTE  bCardID,					/* the specific Card ID that is configured by onboard DIP-switch */
    WORD  wAxis,					/* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U */
		DWORD dwStartSpeed,				/* Start Speed */
		DWORD dwDriveSpeed,				/* Driving Speed */
		DWORD dwAcceleration,			/* Acceleration */
		DWORD dwDeceleration,			/* Deceleration */
		long  FixedPulse				/* total driving pulse */
    );
    
short __stdcall ps400_synch_s_move_cfg
    (
    BYTE  bCardID,					/* the specific Card ID that is configured by onboard DIP-switch */
    WORD  wAxis,					/* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U */
		DWORD dwStartSpeed,				/* Start Speed */
		DWORD dwDriveSpeed,				/* Driving Speed */
		DWORD dwAccelerationRate,		/* AccelerationRate, Jerk (K) */
		DWORD dwDecelerationRate,		/* Deceleration (L) */
		long FixedPulse				/* total driving pulse */    
		);
	
short __stdcall ps400_set_int_factor
    (
    BYTE   bCardID,					/* the specific Card ID that is configured by onboard DIP-switch */
    WORD   wAxis,					/* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U */
		WORD   wIntFactor			/*INT_FACTOR_PULSE ... INT_FACTOR_SYNC_ACTION */
    );


short __stdcall ps400_set_int_action
    (
    	BYTE   bCardID,
    	WORD   wAxes,
    	WORD   wIntFactor,
    	WORD   wActionAxes,				/* can be combination of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U */
    	WORD   wIntAction,
		DWORD  dwLineMoveCfg[]=NULL		    /* move parameter */
    );

short __stdcall	ps400_s_abs_u_shaped_move
	(
		BYTE	bCardID,
		WORD	wAxis[], 
		long	nAbsAddr[],
		long	nCmpAdvDist[],
		DWORD	dwStartSpeed[],
		DWORD	dwDriveSpeed[],
		DWORD	dwAccelerationRate[],
		DWORD	dwDecelerationRate[]
	);

short __stdcall ps400_int_event_config
    (
    BYTE	bCardID,				/* the specific Card ID that is configured by onboard DIP-switch */
    WORD	wIntEventEnable,		/* INT_EVENT_ENABLE_FEATURE/INT_EVENT_DISABLE_FEATURE */
		HANDLE pEventHandle[]			/* The HANDLE array that holds the Axis-relative Eevnt object */
    );
    
short __stdcall ps400_motion_done
    (
    BYTE bCardID,         /* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,           /* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
		BYTE* pDone,
    WORD* pStopStatus	  /* the pointer to the Stop Status*/
    );

short __stdcall ps400_get_speed
    (
    BYTE bCardID,         /* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,           /* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U */
    DWORD* pSpeed		  /* the pointer to the current speed */
    );

short __stdcall ps400_get_acc
    (
    BYTE bCardID,         /* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,           /* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U */
    DWORD* pAcc		  /* the pointer to the current speed */
    );

short __stdcall ps400_get_latch
    (
    BYTE bCardID,         /* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,           /* can be one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U */
    long* pLatchData	  /* the pointer to the current speed */
    );

// Digital IO Status

short __stdcall ps400_get_mdi_status
    (
    BYTE bCardID,         /* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,           /* only one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    WORD* pDIStatus	 			/* the pointer to the DI Status (active status is based on polarity configuration) */
    );

short __stdcall ps400_get_di_status
    (
    BYTE bCardID,         /* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,           /* only one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    WORD* pDIRawStatus	 		/* the pointer to the DI Status (active status is based on polarity configuration) */
    );
	
short __stdcall ps400_get_out1_status
    (
    BYTE bCardID,         /* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,           /* only one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    BYTE* pOut1Status	  /* the pointer to the OU1 (Servo-On) Status */
    );
	
short __stdcall ps400_get_in3
    (
    BYTE bCardID,         /* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,           /* only one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    BYTE* pIN3Status	  	/* the pointer to the IN3 Status */
    );


short __stdcall ps400_get_int_status
    (
    BYTE bCardID,         /* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,           /* only one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    WORD* pIntStatus	  /* the pointer to the Interrupt Status */
    );

short __stdcall ps400_get_error_status
    (
    BYTE bCardID,         /* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,           /* only one of AXIS_X, AXIS_Y, AXIS_Z or AXIS_U*/
    WORD* pErrorStatus	  /* the pointer to the Error Status */
    );
    
short __stdcall ps400_change_p
    (
    BYTE bCardID,				/* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,					/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
		DWORD dwP						/* total output pulse */
		);

short __stdcall ps400_scan_FRnet_DI
    (
    BYTE bCardID,				/* the specific Card ID that is configured by onboard DIP-switch */
		WORD *pDIModules		/* the pointer to the Available FRnet DI modules */
		);


short __stdcall ps400_reset_FRnet
    (
    BYTE bCardID			/* the specific Card ID that is configured by onboard DIP-switch */
		);

short __stdcall ps400_config_FRnet
    (
    BYTE bCardID,					/* the specific Card ID that is configured by onboard DIP-switch */
		WORD wEnablePeriodic, /* FRNET_PERIODIC_READING_ENABLE_FEATURE/FRNET_PERIODIC_READING_DISABLE_FEATURE */
		WORD wPeriodFactor		/* the pointer to the Available FRnet DI modules, T = 2.88 ms * (PeriodFactor + 1) */
		);
	
short __stdcall ps400_get_FRnet_DI
    (
    BYTE bCardID,			/* the specific Card ID that is configured by onboard DIP-switch */
		WORD wSA,				/* Group Address FRNET_SA8 ~ FRNET_SA15 */
		WORD *pStatus,			/* the pointer to the FRnet DI status */
		WORD wEnableDirectAccess = FRNET_ENABLE_DIRECT_ACCESS /* FRNET_ENABLE_DIRECT_ACCESS/FRNET_DISABLE_DIRECT_ACCESS, access the DI module directly, or read the stored status in driver */
		);

short __stdcall ps400_set_FRnet_DO
    (
    BYTE bCardID,			/* the specific Card ID that is configured by onboard DIP-switch */
		WORD wRA,				/* Group Address FRNET_RA0 ~ FRNET_RA7 */
		WORD wDOData			/* the data to DO module */
		);
		
short __stdcall ps400_set_abs_feedback_src
    (
    BYTE bCardID,			/* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,				/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    BYTE bFeedbackSrc       /* can be FEEDBACK_SRC_LOGIC_COMMAND or FEEDBACK_SRC_ENCODER_POSITION */
    );

short __stdcall ps400_set_abs_position
    (
    BYTE bCardID,			/* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,				/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    long nAbsAddr     /* Absolute Address to be set*/
    );
	
short __stdcall ps400_get_abs_position
    (
    BYTE bCardID,			/* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,				/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    long* pAbsAddr     /* Absolute Address to be set*/
    );
	
short __stdcall ps400_t_abs_move
    (
    BYTE bCardID,			/* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,				/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    DWORD dwStartSpeed,		/* Start Speed */
    DWORD dwDriveSpeed,		/* Driving Speed */
    DWORD dwAcceleration,	/* Acceleration */
    DWORD dwDeceleration,	/* Deceleration */
    long  nAbsAddr,       /* Absolute Address */
    short wAccCntOffset	= 0	/* Acceleration Counter Offset */
	);

short __stdcall ps400_t_abs_moveall
    (
    BYTE bCardID,			/* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxes,				/* can be any combination of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    DWORD dwStartSpeed[],		/* Start Speed */
    DWORD dwDriveSpeed[],		/* Driving Speed */
    DWORD dwAcceleration[],	/* Acceleration */
    DWORD dwDeceleration[],	/* Deceleration */
    long AbsAddr[],			/* Absolute Address */
    short wAccCntOffset[]	= NULL	/* Acceleration Counter Offset */
    );

short __stdcall ps400_s_abs_move
    (
    BYTE bCardID,			/* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,				/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    DWORD dwStartSpeed,		/* Start Speed */
    DWORD dwDriveSpeed,		/* Driving Speed */
    DWORD dwAccelerationRate,	/* AccelerationRate, Jerk (K) */
    DWORD dwDecelerationRate,	/* Deceleration (L) */
    long  nAbsAddr,       /* Absolute Address */
    short wAccCntOffset	= 0	/* Acceleration Counter Offset */
	);

short __stdcall ps400_s_abs_moveall
    (
    BYTE bCardID,			/* the specific Card ID that is configured by onboard DIP-switch */
    WORD wAxes,				/* can be any combination of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    DWORD dwStartSpeed[],		/* Start Speed */
    DWORD dwDriveSpeed[],		/* Driving Speed */
    DWORD dwAccelerationRate[],	/* Acceleration */
    DWORD dwDecelerationRate[],	/* Deceleration */
    long AbsAddr[],			/* Absolute Address */
    short wAccCntOffset[]	= NULL /* Acceleration Counter Offset */
    );
    
short __stdcall ps400_t_abs_line2_move
    (
    BYTE bCardID,				/* the specific Card ID that is configured by onboard DIP-switch */
    WORD wMainAxis,				/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    WORD wSlaveAxis,			/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    DWORD dwStartSpeed,			/* Start Speed */
    DWORD dwDriveSpeed,			/* Driving Speed */
    DWORD dwAcceleration,		/* Acceleration */
    DWORD dwDeceleration,		/* Deceleration */
    long MainAxisAbsAddr,	/* Absolute-Address of MainAxis */
    long SlaveAxisAbsAddr,	/* Absolute-Address of SlaveAxis */
    short wAccCntOffset = 0,		/* Acceleration Counter Offset, only valid for IntepStop = TRUE */
    WORD wSyncMode = DISABLE_BLOCK_OPEARTION				/* ENABLE_BLOCK_OPEARTION/DISABLE_BLOCK_OPEARTION */
	);
	    
short __stdcall ps400_t_abs_line3_move
    (
    BYTE bCardID,				/* the specific Card ID that is configured by onboard DIP-switch */
    WORD wMainAxis,				/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    WORD wSecondAxis,			/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    WORD wThirdAxis,			/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    DWORD dwStartSpeed,			/* Start Speed */
    DWORD dwDriveSpeed,			/* Driving Speed */
    DWORD dwAcceleration,		/* Acceleration */
    DWORD dwDeceleration,		/* Deceleration */
    long MainAxisAbsAddr,	/* Absolute-Address of MainAxis */
    long SecondAxisAbsAddr,	/* Absolute-Address of 2nd Axis */
    long ThirdAxisAbsAddr,	/* Absolute-Address of 3rd Axis */
    short wAccCntOffset = 0,		/* Acceleration Counter Offset, only valid for IntepStop = TRUE */
    WORD wSyncMode = DISABLE_BLOCK_OPEARTION				/* ENABLE_BLOCK_OPEARTION/DISABLE_BLOCK_OPEARTION */
    );
	    
short __stdcall ps400_s_abs_line2_move
    (
    BYTE bCardID,				/* the specific Card ID that is configured by onboard DIP-switch */
    WORD wMainAxis,				/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    WORD wSlaveAxis,			/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    DWORD dwStartSpeed,			/* Start Speed */
    DWORD dwDriveSpeed,			/* Driving Speed */
    DWORD dwAccelerationRate,	/* Acceleration */
    DWORD dwDecelerationRate,	/* Deceleration */
    long MainAxisAbsAddr,	/* Absolute-Address of MainAxis */
    long SlaveAxisAbsAddr,	/* Absolute-Address of SlaveAxis */
    short wAccCntOffset = 0,		/* Acceleration Counter Offset, only valid for IntepStop = TRUE */
    WORD wSyncMode = DISABLE_BLOCK_OPEARTION				/* ENABLE_BLOCK_OPEARTION/DISABLE_BLOCK_OPEARTION */
    );    
    
short __stdcall ps400_s_abs_line3_move
    (
    BYTE bCardID,				/* the specific Card ID that is configured by onboard DIP-switch */
    WORD wMainAxis,				/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    WORD wSecondAxis,			/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    WORD wThirdAxis,			/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    DWORD dwStartSpeed,			/* Start Speed */
    DWORD dwDriveSpeed,			/* Driving Speed */
    DWORD dwAccelerationRate,	/* Acceleration */
    DWORD dwDecelerationRate,	/* Deceleration */
    long MainAxisAbsAddr,	/* Absolute-Address of MainAxis */
    long SecondAxisAbsAddr,	/* Absolute-Address of 2nd Axis */
    long ThirdAxisAbsAddr,	/* Absolute-Address of 3rd Axis */
    short wAccCntOffset = 0,		/* Acceleration Counter Offset, only valid for IntepStop = TRUE */
    WORD wSyncMode = DISABLE_BLOCK_OPEARTION	/* ENABLE_BLOCK_OPEARTION/DISABLE_BLOCK_OPEARTION */
    );		
		
short __stdcall ps400_t_abs_arc2_move
    (
    BYTE bCardID,				/* the specific Card ID that is configured by onboard DIP-switch */
    WORD wMainAxis,				/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    WORD wSlaveAxis,			/* only one of AXIS_X, AXIS_Y, AXIS_Z and AXIS_U*/
    DWORD dwStartSpeed,			/* Start Speed */
    DWORD dwDriveSpeed,			/* Driving Speed */
    DWORD dwAcceleration,		/* Acceleration */
    WORD wArcDirection,			/* INTERP_ARC_DIRECTION_CLOCKWISE/INTERP_ARC_DIRECTION_COUNTER_CLOCKWISE */
    long MainAxisCenterAbsAddr,	/* Center absolute-address of MainAxis */
    long SlaveAxisCenterAbsAddr,	/* Center absolute-address of SlaveAxis */
    long MainAxisAbsAddr,	/* Absolute-Address of MainAxis */
    long SlaveAxisAbsAddr,	/* Absolute-Address of SlaveAxis */
    short wAccCntOffset = 0,		/* Acceleration Counter Offset */
    WORD wSyncMode = DISABLE_BLOCK_OPEARTION	/* ENABLE_BLOCK_OPEARTION/DISABLE_BLOCK_OPEARTION */
	);
		
short __stdcall ps400_conti_abs_line2_move
    (
    BYTE bCardID,				/* the specific Card ID that is configured by onboard DIP-switch */
    long MainAxisAbsAddr,	/* Absolute-Address of MainAxis */
    long SlaveAxisAbsAddr,	/* Absolute-Address of SlaveAxis */    
    WORD wContiInterpMoveMode	/* INTERP_CONTINUE_START/INTERP_NEXT_CONTINUOUS_MOTION */
	);
			
short __stdcall ps400_conti_abs_line3_move
    (
    BYTE bCardID,				/* the specific Card ID that is configured by onboard DIP-switch */
    long MainAxisAbsAddr,	/* Absolute-Address of MainAxis */
    long SecondAxisAbsAddr,	/* Absolute-Address of 2nd Axis */    
    long ThirdAxisAbsAddr,	/* Absolute-Address of 3rd Axis */      
    WORD wContiInterpMoveMode	/* INTERP_CONTINUE_START/INTERP_NEXT_CONTINUOUS_MOTION */
	);
	
short __stdcall ps400_conti_abs_arc2_move
    (
    BYTE bCardID,				/* the specific Card ID that is configured by onboard DIP-switch */
    WORD wArcDirection,			/* INTERP_ARC_DIRECTION_CLOCKWISE/INTERP_ARC_DIRECTION_COUNTER_CLOCKWISE */
    long MainAxisCenterAbsAddr,	/* Center absolute-address of MainAxis */
    long SlaveAxisCenterAbsAddr,	/* Center absolute-address of SlaveAxis */
    long MainAxisAbsAddr,	/* Absolute-Address of MainAxis */
    long SlaveAxisAbsAddr,	/* Absolute-Address of SlaveAxis */
    WORD wContiInterpMoveMode	/* INTERP_CONTINUE_START/INTERP_NEXT_CONTINUOUS_MOTION */
	);
	
//160422
short __stdcall ps400_t_move_batch_3steps(
    BYTE bCardID,			/* The specific Card ID that is configured by onboard DIP-switch */
    WORD wAxis,				/* only one of AXIS_0, AXIS_1, AXIS_2, AXIS_3, AXIS_4, AXIS_5*/		
    DWORD dwStartSpeed,		/* Start Speed */
    DWORD dwDriveSpeedStep1,/* Driving Speed */
    DWORD dwDriveSpeedStep2,/* Driving Speed */
    DWORD dwDriveSpeedStep3,/* Driving Speed */	
    DWORD dwAccDecStep1,	/* Acceleration/Deceleration */
    DWORD dwAccDecStep2,	/* reserved */
    DWORD dwAccDecStep3,	/* Acceleration/Deceleration */	
    long  FixedPulseStep1,	/* total driving pulse */	
    long  FixedPulseStep2,	/* total driving pulse */
    long  FixedPulseStep3	/* total driving pulse */			
		);
					
#ifdef __cplusplus
}
#endif

#endif





